onmessage = ({ data }) => {
  let a = new Worker(new URL('@/utils/point24.ts', import.meta.url))
  a.postMessage({
    numbers: data.numbers
      .map((e: string) => (+e < 0 ? `-${e}` : e))
      .map((e: string) => ({
        val: Math.sqrt(+e),
        path: `√${e}`,
        back: 'SquareRoot'
      })),
    target: +data.target,
    epsilon: data.epsilon === undefined ? undefined : +data.epsilon
  })
  a.onmessage = ({ data }) => {
    postMessage(data)
    if (data.done) close()
  }
  a.onerror = (e) => {
    console.log(e)
    postMessage({ value: e, done: true })
    close()
  }
  a.onmessageerror = (e) => {
    console.log(e)
    postMessage({ value: e, done: true })
    close()
  }
}
